<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <title></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>申报采购计划</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
			<li class="active"><a href="#">采购计划管理</a></li>
            <li class="active"><a href="#">申报采购计划</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            	<div class="input">
            		<div class="textalign1">项目编号：</div>
            		<div class="boxinput">
            			<input class="textinput" type="text" id="projCode" name="projCode" placeholder="项目编号" />
            		</div>
            		<div class="textalign">项目名称：</div>
            		<div class="boxinput">
            			<input class="textinput" type="text" id="name" name="name" placeholder="项目名称" />
            		</div>
            		<div class="textalign">
            			<button type="button" onclick="gridSerch()" class="btn btn-success btn-sm" id="selectc">查&nbsp;询</button>
            		</div>
            	</div>
            </div>
        </div>

        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>

    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
    
	  //绑定回车
	    $('#projCode,#name').bind('keydown', function(event) {
	        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
	            $('#selectc').click();
	        }
	    }); 
			
	    $("#projCode").focus();//加载页面光标在第一个查询框内
    
        $(function () {
            $("#gridlist").jqGrid({
                url: "${pageContext.request.contextPath}/wsjplan/getWsjPlanProjectList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                //shrinkToFit:false,
                height: 255,
                colNames: ['操作','projId','项目编号', '项目名称','项目类型', '申报开始日期', '申报结束日期', '状态', '已申报药品' ],
                colModel: [
                    { name: 'oper', width: 80, align: 'center' ,sortable: false,
	                       formatter: function (val, opts, rowdata) {
		                     var str ="<a href='${ctx}/wsjplan/toNoDeclareDrugList.html?projId="+rowdata.projId+"'  style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px -80px' class='opIcon' title='申报'></a>";
		                     return str;
	                       }	
                    },
                    { name: 'projId', hidden:true,width: 40, align: 'center' ,sortable: false},
                    { name: 'projCode', width: 120, align: 'center' ,sortable: false},
                    { name: 'name', width: 300, align: 'center' ,sortable: false},
                    { name: 'projCat', width: 120, align: 'center' ,sortable: false},
                    { name: 'starttime', width: 120, align: 'center' ,sortable: false},
                    { name: 'endtime', width: 120, align: 'center' ,sortable: false},
                    { name: 'status', width: 80, align: 'center' ,sortable: false,
                    	 formatter: function (val, opts, rowdata) {
 							if(rowdata.status == 1){
 								return "启用";
 							}else if(rowdata.status == 0){
 								return "停用";
 							}else {
 								return "";
 							}
 						}
                    },
                    { name: 'drugCount', width: 120, align: 'center' ,sortable: false,
					    formatter: function (val, opts, rowdata) {
							return "<a href=\"toDeclareDrugList.html?projId="+rowdata.projId + "\">"+val+"</a>";
						}
					}
                    
                ],
                rowNum: 20,
                rowList: [10, 20,50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "申报采购计划",
                jsonReader: {
                    repeatitems: false  
                },
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        function gridSerch() {
        	var projCode = $("#projCode").val();
        	var name = $("#name").val();
        	var status = $("#status").val();
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{"projCode":projCode,
    	        		"name":name,
    	        		"status":status}
    	    }).trigger("reloadGrid"); //重新载入  
    	}
        
    </script>
</body>
</html>
